package com.hmkj.core.mapper.index;

import com.hmkj.common.baseMapper.GenericMapper;
import com.hmkj.core.po.index.EquityRecommend;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 首页动态相关Dao接口<br>
 *
 * @author eproo
 * @date 2018-07-09 02:02:41
 */
public interface EquityRecommendMapper extends GenericMapper<EquityRecommend, Integer> {

    @Select("SELECT t.* FROM biz_equity_recommend t WHERE 1=1 ${whereSql} ${sortSql} limit ${nowPage}, ${pageSize} ")
    List<EquityRecommend> findListBySqlJoin(Map<String, Object> params);

    @Select("SELECT count(1) FROM biz_equity_recommend t WHERE 1=1 ${whereSql}")
    long countBySqlJoin(Map<String, Object> params);

    /**
     * 首页每日推荐前10
     *
     * @return
     */
    @Select("SELECT t.* FROM biz_equity_recommend t WHERE  1=1 AND today_recommend = #{today} limit 10")
    List<EquityRecommend> selectRecommend(@Param(value = "today") Integer today);
}
